package simplefactroy;

/**
 * @program: HomeWork
 * @description: 课程工厂
 * @author: hezhiqin
 * @create: 2019-09-24 10:30
 */
public class CourseFactroy {

//    public  ICourse create (String name){
//        if ("java".equals(name)){
//            return  new JavaCourse();
//        }else {
//            return null;
//        }
//
//    }


    public  ICourse create (String className){
        try {
            if (!(null==className||"".equals(className)))
                return  (ICourse)Class.forName(className).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }finally {

        }
        return null;
    }
}
